<template>
  <div class="set_token">
    <van-cell-group>
      <van-field v-model="tokenValue" label="设置Token" placeholder="请输入Token值" />
    </van-cell-group>

    <div class="token_btn">
      <van-button size="small" type="primary" class=" coll_80"  @click="save">设置token</van-button>	
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      tokenValue:''
    }
  },
  methods: {
    save(){
      sessionStorage.setItem('token', this.tokenValue);
      this.$router.push({
        name:'Index'
      })
    }
  }/* ,
  created(){
    let u = navigator.userAgent;
    let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android终端
    let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    // android();
    if (isAndroid) {
      window.location.href ='cncomdo1cookcarc://index';   // 打开app的协议，有安卓同事提供
      window.setTimeout(() => {
        window.location.href = 'cncomdo1cookcarc://index';   // 打开app的协议，有安卓同事提供
        // window.location.href = 'http://www.wjtr.com/download/index.html';  //下载app的协议，有安卓同事提供
      }, 2000);
    }
    if (isIOS) {
      let ifr = document.createElement("iframe");
      ifr.src ='cncomdo1cookcarc://index';  // 打开app的协议，有ios同事提供
      ifr.style.display = "none";
      document.body.appendChild(ifr);
      window.setTimeout(() => {
        document.body.removeChild(ifr);
        window.location.href ='cncomdo1cookcarc://index';   // 打开app的协议，有安卓同事提供
        // window.location.href ='http://www.wjtr.com/download/index.html';  // 下载app的地址
      }, 2000);
    }
  } */
}
</script>
<style lang="less" scoped>
.set_token{
  .token_btn{
    width: 100vw;
    display: flex;
    justify-content: center;
    margin-top: 20px;
  }
}
</style>